package com.ruoyi.project.setting.security;

import com.ruoyi.common.entity.BaseUser;
import com.ruoyi.project.system.entity.SysMenu;
import com.ruoyi.project.system.entity.SysRole;
import com.ruoyi.project.system.entity.SysUser;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.util.*;

/**
 * 登陆用户
 *
 * @author dyun
 */
@EqualsAndHashCode(callSuper = true)
@Data
public class LoginUser extends BaseUser implements Serializable {

    private SysUser sysUser;

    /**
     * 角色
     */
    private Set<String> roles = new HashSet<>();

    /**
     * 角色组
     */
    private List<SysRole> roleList = new ArrayList<>();

    /**
     * 资源组
     */
    private List<SysMenu> resourceList = new ArrayList<>();

    /**
     * 权限
     */
    private Set<String> permissions = new HashSet<>();

    public LoginUser toLoginUserVO() {
        this.roleList = new ArrayList<>();
        this.resourceList = new ArrayList<>();
        return this;
    }
}
